﻿using Messhall.Framework.Domain.DomainObject;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Messhall.Domain.Permission.BusinessObjects
{

    public class UsersRoleEntity : EntityBoBase
    {
        #region 成员变量
        /// <summary>
        /// 用户Id
        /// </summary>
        public Guid UsersKeyId { get; set; }

        /// <summary>
        /// 角色Id
        /// </summary>
        public Guid RoleKeyId { get; set; }

        #endregion
    }

    public class UsersRole : BoBase, IAggregateRoot
    {
        private UsersRoleEntity SelfEntity
        {
            get { return Entity as UsersRoleEntity; }
            set { this.Entity = value; }
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="entity"></param>
        public UsersRole(UsersRoleEntity entity)
        {
            this.SelfEntity = entity;
        }

        public UsersRole(Guid roleKeyId, Guid usersKeyId)
        {
            this.SelfEntity.RoleKeyId = usersKeyId;
            this.SelfEntity.UsersKeyId = roleKeyId;
        }

        public Guid GetUserKeyId()
        {
            return this.SelfEntity.UsersKeyId;
        }

        public void SetUserKeyId(Guid usersKeyId)
        {
            this.SelfEntity.UsersKeyId = usersKeyId;
        }

        public Guid GetRoleKeyId()
        {
            return this.SelfEntity.RoleKeyId;
        }

        public void SetRoleKeyId(Guid roleKeyId)
        {
            this.SelfEntity.RoleKeyId = roleKeyId;
        }

    }
}
